import { createRouter, createWebHistory, createWebHashHistory } from "vue-router";

export const routes = [
    {
        path: '/',
        redirect: '/virtual-list',
    },
    // {
    //     path: '/tab-header',
    //     name: 'tab-header',
    //     meta: {
    //         title: '控制水平滚动'
    //     },
    //     component: () => import('@/views/tab-header')
    // },
    {
        path: '/virtual-list',
        name: 'virtual-list',
        meta: {
            title: '虚拟列表'
        },
        component: () => import('@/views/virtual-list')
    },
    {
        path: '/double-columns-resize',
        name: 'double-columns-resize',
        meta: {
            title: '分栏拖拽'
        },
        component: () => import('@/views/double-columns-resize')
    },
    {
        path: '/free-move',
        name: 'free-move',
        meta: {
            title: '自由移动'
        },
        component: () => import('@/views/free-move')
    },
    {
        path: '/free-resize',
        name: 'free-resize',
        meta: {
            title: '自由大小'
        },
        component: () => import('@/views/free-resize')
    },
    {
        path: '/free-box',
        name: 'free-box',
        meta: {
            title: '自由盒子'
        },
        component: () => import('@/views/free-box')
    },
    {
        path: '/free-window',
        name: 'free-window',
        meta: {
            title: '自由窗口'
        },
        component: () => import('@/views/free-window')
    },
    {
        path: '/crop-picture',
        name: 'crop-picture',
        meta: {
            title: '图片裁剪'
        },
        component: () => import('@/views/crop-picture')
    },
    {
        path: '/paint-2d',
        name: 'paint-2d',
        meta: {
            title: '绘图2D'
        },
        component: () => import('@/views/paint-2d')
    },
    {
        path: '/water-mark',
        name: 'water-mark',
        meta: {
            title: '水印'
        },
        component: () => import('@/views/water-mark')
    },
];

const router = createRouter({
    // history: createWebHistory(),
    history: createWebHashHistory(),
    routes
});

router.beforeEach((to, form) => {
    document.title = `${to.name}：${to.meta.title}`;
});

export default  router;

